//
//  RootViewController.m
//  YYPHSpeedJump
//
//  Created by sujiang on 15/12/16.
//  Copyright © 2015年 sujiang. All rights reserved.
//

#import "RootViewController.h"
#import "SJHomeViewController.h"
#import "ShareHomeViewController.h"
#import "PurchaseHomeViewController.h"
#import "MineHomeViewController.h"
#import "BaseNavigationController.h"

@interface RootViewController ()

@end

@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self addChildsVC];
    self.tabBar.tintColor = kColors(218, 166, 46, 1);
    self.view.backgroundColor = kColors(255, 255, 255, 1);
}

- (void)addChildsVC
{
    [self addViewControllerClass:NSClassFromString(@"SJHomeViewController") title:@"速降" imageName:@"sy" selectImageName:@"djsy"];

    [self addViewControllerClass:NSClassFromString(@"ShareHomeViewController") title:@"晒单" imageName:@"sd" selectImageName:@"djsd"];
    [self addViewControllerClass:NSClassFromString(@"PurchaseHomeViewController") title:@"心愿墙" imageName:@"xyq" selectImageName:@"djxyq"];
    
    [self addViewControllerClass:NSClassFromString(@"MineHomeViewController") title:@"我的" imageName:@"grzx" selectImageName:@"djgrzx"];
    
}



- (void)addViewControllerClass:(Class)class title:(NSString *)title imageName:(NSString *)imageName selectImageName:(NSString *)selectImage
{
    UIViewController *viewC = [[class alloc] init];
    BaseNavigationController *naviVC = [[BaseNavigationController alloc] initWithRootViewController:viewC];
    naviVC.tabBarItem.title = title;
    naviVC.tabBarItem.selectedImage = [UIImage imageNamed:selectImage];
    naviVC.tabBarItem.image = [UIImage imageNamed:imageName];
    [self addChildViewController:naviVC];
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
